package net.sudot.chess.event.order;

import net.sudot.chess.business.model.BaseOrder;
import net.sudot.chess.business.model.Customer;
import org.springframework.context.ApplicationEvent;

/**
 * 订单事件
 *
 * @author tangjialin on 2018-06-16.
 */
public abstract class OrderEvent<E extends BaseOrder> extends ApplicationEvent {

    /** 订单信息 */
    private E order;
    /** 订单所属客户 */
    private Customer customer;

    /**
     * 构建新的订单
     *
     * @param source   事件最初发生的对象
     * @param order    订单信息
     * @param customer 订单所属客户
     */
    public OrderEvent(Object source, E order, Customer customer) {
        super(source);
        this.order = order;
        this.customer = customer;
    }

    /**
     * 获取订单信息
     *
     * @return 返回订单信息
     */
    public E getOrder() {
        return order;
    }

    /**
     * 获取订单所属客户
     *
     * @return 返回订单所属客户
     */
    public Customer getCustomer() {
        return customer;
    }
}
